ROOM
	ID 6503
        	NOPAINTING
	NOCYBORGS
	NAME "Yahtzee 6 Da Boy"
	PICT "qyaht6boy3.jpg"
	PICTURE ID 1 NAME "onept.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 2 NAME "dice1sun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 3 NAME "dice2sun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 4 NAME "dice3sun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 5 NAME "dice4sun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 6 NAME "dice5sun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 7 NAME "dice6sun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 8 NAME "yahtholdsun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 9 NAME "1marksun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 10 NAME "2marksun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 11 NAME "3marksun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 12 NAME "3xmarksun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 13 NAME "4lightsun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 14 NAME "dicer1sun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 15 NAME "dicer2sun.gif" TRANSCOLOR 0 ENDPICTURE
	PICTURE ID 16 NAME "dicer3sun.gif" TRANSCOLOR 0 ENDPICTURE
	SPOT
		ID 1
		OUTLINE 21,171  51,171  51,198  21,198
		LOC 35,182
		PICTS 1,0,0 2,0,0 3,0,0 4,0,0 5,0,0 6,0,0 7,0,0 14,0,0 15,0,0 16,0,0 ENDPICTS
		ENDSPOT
	SPOT
		ID 2
		OUTLINE 61,171  91,171  91,198  61,198
		LOC 75,182
		PICTS 1,0,0 2,0,0 3,0,0 4,0,0 5,0,0 6,0,0 7,0,0 14,0,0 15,0,0 16,0,0 ENDPICTS
		ENDSPOT
	SPOT
		ID 3
		OUTLINE 103,171  133,171  133,198  103,198
		LOC 117,182
		PICTS 1,0,0 2,0,0 3,0,0 4,0,0 5,0,0 6,0,0 7,0,0 14,0,0 15,0,0 16,0,0 ENDPICTS
		ENDSPOT
	SPOT
		ID 4
		OUTLINE 142,171  172,171  172,198  142,198
		LOC 157,182
		PICTS 1,0,0 2,0,0 3,0,0 4,0,0 5,0,0 6,0,0 7,0,0 14,0,0 15,0,0 16,0,0 ENDPICTS
		ENDSPOT
	SPOT
		ID 5
		OUTLINE 184,171  214,171  214,198  184,198
		LOC 199,182
		PICTS 1,0,0 2,0,0 3,0,0 4,0,0 5,0,0 6,0,0 7,0,0 14,0,0 15,0,0 16,0,0 ENDPICTS
		ENDSPOT
	SPOT
		ID 6
		OUTLINE 224,171  254,171  254,198  224,198
		LOC 239,182
		PICTS 1,0,0 2,0,0 3,0,0 4,0,0 5,0,0 6,0,0 7,0,0 14,0,0 15,0,0 16,0,0 ENDPICTS
		ENDSPOT
	SPOT
		ID 13
		DONTMOVEHERE
		OUTLINE 97,27  156,27  156,45  97,45
		LOC 128,36
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL
myturn GLOBAL
{ dd STRTOATOM EXEC 0 GET crv = ME co =
"@140,30 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 14
		DONTMOVEHERE
		OUTLINE 97,47  156,47  156,65  97,65
		LOC 128,56
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL
myturn GLOBAL
{ dd STRTOATOM EXEC 1 GET 2 * crv = ME co =
"@140,50 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 15
		DONTMOVEHERE
		OUTLINE 97,67  156,67  156,85  97,85
		LOC 128,76
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL
myturn GLOBAL
{ dd STRTOATOM EXEC 2 GET 3 * crv = ME co =
"@140,70 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 16
		DONTMOVEHERE
		OUTLINE 97,87  156,87  156,105  97,105
		LOC 128,96
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL
myturn GLOBAL
{ dd STRTOATOM EXEC 3 GET 4 * crv = ME co =
"@140,90 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 17
		DONTMOVEHERE
		OUTLINE 97,107  156,107  156,125  97,125
		LOC 128,116
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL
myturn GLOBAL
{ dd STRTOATOM EXEC 4 GET 5 * crv = ME co =
"@140,110 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 18
		DONTMOVEHERE
		OUTLINE 97,127  156,127  156,145  97,145
		LOC 128,136
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL
myturn GLOBAL
{ dd STRTOATOM EXEC 5 GET 6 * crv = ME co =
"@140,130 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 19
		DONTMOVEHERE
		OUTLINE 310,7  369,7  369,25  310,25
		LOC 339,16
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL dt GLOBAL
myturn GLOBAL
{ dd "[3456]" GREPSTR dt * crv =
 ME co =
"@352,10 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 20
		DONTMOVEHERE
		OUTLINE 310,27  369,27  369,45  310,45
		LOC 339,36
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL dt GLOBAL
myturn GLOBAL
{ dd "[456]" GREPSTR dt * crv =
 ME co =
"@352,30 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 21
		DONTMOVEHERE
		OUTLINE 310,47  369,47  369,65  310,65
		LOC 339,56
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL dt GLOBAL
myturn GLOBAL
{ dd "[56]" GREPSTR dt * crv =
 ME co =
"@352,50 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 22
		DONTMOVEHERE
		OUTLINE 310,67  369,67  369,85  310,85
		LOC 339,76
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL dt GLOBAL
myturn GLOBAL
{ dd "3.*3" GREPSTR 35 *  crv =
 ME co =
"@352,70 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 23
		DONTMOVEHERE
		OUTLINE 310,87  369,87  369,105  310,105
		LOC 339,96
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL dt GLOBAL
myturn GLOBAL
{ dd "4" SUBSTR dd "2" SUBSTR AND 45 *  crv =
 ME co =
"@352,90 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 24
		DONTMOVEHERE
		OUTLINE 310,127  369,127  369,145  310,145
		LOC 339,136
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL dt GLOBAL
myturn GLOBAL
{ dt crv = ME co =
"@352,130 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 25
		DONTMOVEHERE
		OUTLINE 448,27  507,27  507,45  448,45
		LOC 477,36
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL dt GLOBAL
myturn GLOBAL
{ dd " [123] [123] [123] [123] " GREPSTR 30 *  crv =
 ME co =
"@465,30 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 26
		DONTMOVEHERE
		OUTLINE 448,47  507,47  507,65  448,65
		LOC 477,56
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL dt GLOBAL
myturn GLOBAL
{ dd " [12] [12] [12] [12] [12] " GREPSTR 40 *  crv =
 ME co =
"@465,50 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 27
		DONTMOVEHERE
		OUTLINE 448,67  507,67  507,85  448,85
		LOC 477,76
		PICTS 1,0,0 9,0,0 ENDPICTS
		SCRIPT
ON SELECT { dd GLOBAL crv GLOBAL co GLOBAL dt GLOBAL
myturn GLOBAL
{ dd " 1 1 1 1 1 1 " GREPSTR 50 *  crv =
 ME co =
"@465,70 That will give you a score of " crv ITOA & LOCALMSG
} myturn ME GETSPOTSTATE NOT AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 28
		DONTMOVEHERE
		OUTLINE 310,107  369,107  369,125  310,125
		LOC 339,116
		PICTS 1,0,0 9,0,0 10,0,0 11,0,0 12,0,0 12,0,0 12,0,0 12,0,0 12,0,0 12,0,0 12,0,0 12,0,0 12,0,0 12,0,0 12,0,0 12,0,0 ENDPICTS
		SCRIPT
ON SELECT { yhtz GLOBAL co GLOBAL dd GLOBAL myturn GLOBAL
crv GLOBAL mysc GLOBAL btt GLOBAL
{ dd "6" SUBSTR yts =
   { 
    { "Sorry, as you zeroed out your Yahtzee line earlier, you are ineligible for a bonus." LOCALMSG
    } yts yhtz 0 < AND IF
    { ")applause " USERNAME " collects a YAHTZEE6 BONUS! CONGRATULATIONS!!" & & ROOMMSG
      "@511,0 Joker rules-- you get to score it on a regular line as well!" LOCALMSG
       200 mysc += ME GETSPOTSTATE 1 + ME SETSPOTSTATE
      1 btt = yhtz ++
    } yts yhtz 0 > AND btt NOT AND IF
   }
   { ;yahtzee for the first time, -1 if yts is 0, 1 if yts is 1
     yts 100 * crv = ME co =
     "@352,110 This will score you a " crv ITOA & LOCALMSG
     { "!WARNING: zeroing out this box makes you ineligible for Yahtzee bonuses!" LOCALMSG
     } crv NOT IF    
   } yhtz IFELSE
} myturn IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 29
		DONTMOVEHERE
		OUTLINE 467,127  484,127  484,145  467,145
		LOC 488,136
		PICTS 1,0,0 9,9,0 ENDPICTS
		SCRIPT
ON SELECT { ut GLOBAL myturn GLOBAL
{
 { "@480,130 You need " 80 ut - ITOA & " more points to get the upper table bonus" & LOCALMSG }
 { "@480,130 You already have the upper table bonus!" LOCALMSG
 } ME GETSPOTSTATE NOT IFELSE
} myturn IF
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 12
		DONTMOVEHERE
		OUTLINE 228,161  262,161  262,205  228,205
		LOC 240,183
		PICTS 1,0,0 8,0,0 ENDPICTS
		SCRIPT
ON SELECT { myturn GLOBAL
{ ME GETSPOTSTATE NOT ME SETSPOTSTATE
} myturn 32 GETSPOTSTATE AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 11
		DONTMOVEHERE
		OUTLINE 179,161  226,161  226,205  179,205
		LOC 199,183
		PICTS 1,0,0 8,0,0 ENDPICTS
		SCRIPT
ON SELECT { myturn GLOBAL
{ ME GETSPOTSTATE NOT ME SETSPOTSTATE
} myturn 32 GETSPOTSTATE AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 10
		DONTMOVEHERE
		OUTLINE 136,161  178,161  178,205  136,205
		LOC 158,183
		PICTS 1,0,0 8,0,0 ENDPICTS
		SCRIPT
ON SELECT { myturn GLOBAL
{ ME GETSPOTSTATE NOT ME SETSPOTSTATE
} myturn 32 GETSPOTSTATE AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 9
		DONTMOVEHERE
		OUTLINE 94,161  135,161  135,205  94,205
		LOC 117,183
		PICTS 1,0,0 8,0,0 ENDPICTS
		SCRIPT
ON SELECT { myturn GLOBAL
{ ME GETSPOTSTATE NOT ME SETSPOTSTATE
} myturn 32 GETSPOTSTATE AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 8
		DONTMOVEHERE
		OUTLINE 53,161  93,161  93,205  53,205
		LOC 76,183
		PICTS 1,0,0 8,0,0 ENDPICTS
		SCRIPT
ON SELECT { myturn GLOBAL
{ ME GETSPOTSTATE NOT ME SETSPOTSTATE
} myturn 32 GETSPOTSTATE AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 7
		DONTMOVEHERE
		OUTLINE 12,161  52,161  52,205  12,205
		LOC 35,183
		PICTS 1,0,0 8,0,0 ENDPICTS
		SCRIPT
ON SELECT { myturn GLOBAL
{ ME GETSPOTSTATE NOT ME SETSPOTSTATE
} myturn 32 GETSPOTSTATE AND IF
}
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 31
		NAME "Start Game"
		DONTMOVEHERE
		LOC 459,27
		SCRIPT
ON ENTER { { "A game of Yahtzee6 is currently being played, please click play to join!" LOCALMSG } ME GETSPOTSTATE 
WHONAME "." GREPSTR IF 
{ 0 ME SETSPOTSTATE } ME GETSPOTSTATE WHOME == IF
{ POSX 160 RANDOM 224 + SETPOS } POSY 225 < IF

ad GLOBAL "" ad = 
"Script by Foxy, Graphics by Quirky's" STATUSMSG

{ DUP GLOBAL 0 SWAP =
} [ ref rollt crv mysc ut yhtz plyrs ckbxs myturn co lastroll] FOREACH

al27 GLOBAL
{ dt GLOBAL dd GLOBAL lastroll GLOBAL
  { { EXEC SETSPOTSTATE
    } lastroll STRTOATOM EXEC FOREACH
  } lastroll 0 != IF
    0 dt = [ 0 0 0 0 0 0 ] dd =
   "[ " lastroll =
 { dc = dc 6 + GETSPOTSTATE lck = 
  { 6 RANDOM 1 + dv = dv dc SETSPOTSTATE }
  { dc GETSPOTSTATE dv = } lck NOT IFELSE
  dv dt += dd dv 1 - GET 1 + dd dv 1 - PUT
  lastroll "{" + dv ITOA + " " + dc ITOA + " }" + lastroll =
 } [ 1 2 3 4 5 6 ] FOREACH
"[ " { ITOA + " " + } dd FOREACH
" ]" & dd =
lastroll "]" + lastroll =
{ "@105,268 )applause !YAHTZEE6 CONGRATULATIONS!!" ROOMMSG
} dd "6" SUBSTR IF
} al27 DEF

 al26 GLOBAL
{ rollt GLOBAL dd GLOBAL dt GLOBAL
crv GLOBAL 0 crv = co GLOBAL 0 co =
{ ")yahtroll" SAY } rollt 6 == IF
{ 0 cr = rollt --
 { cr ++
  { 7 rollt cr + DUP 3 / 3 * - + cr SETSPOTSTATE 
  } cr 6 + GETSPOTSTATE NOT IF
 } { cr 6 < } WHILE
 al26 GLOBAL al26 30 ALARMEXEC
}
{ al27 GLOBAL al27 EXEC
} rollt IFELSE
} al26 DEF

al24 GLOBAL
{ plyrs GLOBAL hsc GLOBAL phsc GLOBAL ref GLOBAL
{  { "@0,100 !Game over!" ROOMMSG
   { "@100,100 ..and our winner is: " ROOMMSG
    "@160,160 )applause !" phsc & "!!" & ROOMMSG
   } hsc IF
   0 ref = 1 sp =
 { 0 sp SETSPOTSTATE sp ++ } { sp 33 < } WHILE
{ ";5" SAY } 60 ALARMEXEC
  } plyrs "." GREPSTR NOT IF
} ref IF
} al24 DEF

al25 GLOBAL
{ plyrs GLOBAL al25 GLOBAL al24 GLOBAL
plyrs "^-([0-9]+)-(.*)$" GREPSTR POP
"$1" GREPSUB cp = "$2" GREPSUB oth =
{ oth GREPSUB plyrs = plyrs "^-([0-9]+)-(.*)$" GREPSTR POP
   "$1" GREPSUB cp = "$2" GREPSUB oth =
} { cp ATOI WHONAME "." GREPSTR NOT plyrs "" == NOT AND } WHILE
{ "@" cp ATOI WHOPOS ITOA SWAP ITOA " " & SWAP & & cp ATOI WHONAME " is up!" & & ROOMMSG
  ";3" cp & cp ATOI PRIVATEMSG
  oth "-" & cp & "-" & plyrs =
}
{ al24 30 ALARMEXEC
} plyrs "" == NOT IFELSE
} al25 DEF


}
ON SELECT { ref GLOBAL plyrs GLOBAL ad GLOBAL hsc GLOBAL phsc GLOBAL
{ { "A game is currently in session. Click play to join." LOCALMSG }
  { "Resetting game, click again to start a new one." LOCALMSG
    0 ME SETSPOTSTATE ";5" SAY 
   { cr ++ 0 cr SETSPOTSTATE } { cr 29 < } WHILE 
  } ME GETSPOTSTATE WHONAME "." GREPSTR IFELSE
}
{ WHOME ME SETSPOTSTATE 1 ref = "" plyrs = "-" ad = 0 hsc = "" phsc =
 USERNAME " has started a game of Yahtzee6! Click play to join!" & ROOMMSG
 "@511,0" USERNAME & ", click the roll button to start play after everyone joins." & LOCALMSG
} ME GETSPOTSTATE IFELSE
}

ON INCHAT { ref GLOBAL plyrs GLOBAL phsc GLOBAL hsc GLOBAL
{
 { DUP GLOBAL 0 SWAP =
 } [ ref rollt crv mysc ut yhtz plyrs ckbxs myturn co phsc hsc btt lastroll] FOREACH
 "" plyrs =
} CHATSTR ";5" == IF
{ 0 ref = "" plyrs = "" phsc = 0 hsc =
} ref WHOME ME GETSPOTSTATE <> AND IF

;26 inchat

 mysc GLOBAL ckbxs GLOBAL ut GLOBAL yhtz GLOBAL
rollt GLOBAL myturn GLOBAL co GLOBAL dd GLOBAL dt GLOBAL
{ { 0 SWAP SETSPOTSTATE } [ 7 8 9 10 11 12] FOREACH
 1 myturn = 13 sp = ckbxs tckbxs =
{ tckbxs DUP 2 / 2 * - sp SETSPOTSTATE
  2 tckbxs /= sp ++
} { sp 28 < } WHILE
{ 1 28 SETSPOTSTATE 
{ yhtz 28 SETSPOTSTATE } yhtz 1 > IF
}
{ 0 28 SETSPOTSTATE } yhtz IFELSE
0 32 SETSPOTSTATE 0 crv = 0 co =
"[0 0 0 0 0 0]" dd = 0 dt =
ut 80 >= 29 SETSPOTSTATE
{ 0 SWAP SETSPOTSTATE } [ 1 2 3 4 5 6 ] FOREACH
} ";3" WHOME ITOA & CHATSTR == IF



;25 inchat

 ref GLOBAL plyrs GLOBAL ad GLOBAL
mysc GLOBAL ckbxs GLOBAL ut GLOBAL yhtz GLOBAL
plyrs GLOBAL hsc GLOBAL phsc GLOBAL al25 GLOBAL
ad "." GREPSTR stt =
{ "-" WHOCHAT ITOA & "-" & ad =
 { "You're already in the game, " WHOCHAT WHONAME & 
   WHOCHAT PRIVATEMSG
 }
 { WHOCHAT WHONAME " has joined the game! GOOD LUCK!!" & ROOMMSG
  ";2" WHOCHAT ITOA & WHOCHAT PRIVATEMSG
  ad plyrs & plyrs =
 } plyrs ad SUBSTR IFELSE
{ "" ad = } stt NOT IF
} CHATSTR ";1" == ref AND IF
{ ;initialize variables to play
0 mysc = 0 ckbxs = 0 ut = 0 yhtz =
} CHATSTR ";2" WHOME ITOA & == IF
{ al25 90 ALARMEXEC
} ";3" CHATSTR == ref AND IF
{ "-$1-" GREPSUB pq =
  "$2" GREPSUB ATOI ps =
  ")applause !" "$1" GREPSUB ATOI WHONAME " has finished with a final score of " & &
  "$2!" GREPSUB & DUP SUSRMSG ROOMMSG
   { "@150,0 !New high score for the game!" ROOMMSG
    "$1" GREPSUB ATOI WHONAME phsc = ps hsc =   
   } ps hsc > IF
  plyrs "^(.*)" pq & "(.*)$" & GREPSTR POP
  "$1$2" GREPSUB plyrs =
  al24 GLOBAL al24 60 ALARMEXEC al25 120 ALARMEXEC
} CHATSTR "^;4([0-9]+)-([0-9]+)$" GREPSTR ref AND IF
{ { "$1$2" GREPSUB plyrs = 
    WHOCHAT WHONAME " has left the game. SOBBING!!" & ROOMMSG
{ al25 EXEC } "$2" GREPSUB "" == IF
  } plyrs "^(.*)-" WHOCHAT ITOA "-(.*)$" & & GREPSTR IF
} CHATSTR ";6" == ref AND IF


}
ON OUTCHAT { { "" CHATSTR = } CHATSTR "^;" GREPSTR IF 

 ref GLOBAL plyrs GLOBAL al25 GLOBAL
 { "" CHATSTR = plyrs tp = "[ " plar = "$1" GREPSUB ATOI drp =
  { plar " $1 " GREPSUB & plar = "$2" GREPSUB tp =
  } { tp "^-([0-9]+)-(.*)$" GREPSTR } WHILE
  plar "]" & STRTOATOM EXEC plar =
  { drp -- "" plyrs = 0 cnt =
   { ts =
     { plyrs "-" & ts ITOA & "-" & plyrs = }
     { "Dropping " ts WHONAME & " from the game" & LOGMSG
     } cnt drp != IFELSE
     cnt ++
   } plar FOREACH
  } drp 0 > plar LENGTH drp >= AND IF
  { al25 25 ALARMEXEC } plar LENGTH drp 1 + == IF

 } ref CHATSTR "player drop *([0-9]+)$" GREPSTR AND IF

 { "" CHATSTR = plyrs tp = 0 ps =
   "Current players:" LOGMSG
   { ps ++ ps ITOA ". " & "$1" GREPSUB ATOI WHONAME & LOGMSG
     "$2" GREPSUB tp = 
   } { tp "^-([0-9]+)-(.*)$" GREPSTR } WHILE
 } ref CHATSTR "player list" == AND IF

}
ON LEAVE { ";6" SAY }
		ENDSCRIPT
		ENDSPOT
	SPOT
		ID 32
		NAME "Start - Play - Roll - Help - Quit"
		DONTMOVEHERE
		OUTLINE 284,160  510,160  510,203  284,203
		LOC 396,154
		PICTS 13,77,-39 13,94,-39 13,111,-39 13,128,-39 1,0,0 ENDPICTS
		SCRIPT
ON SELECT { MOUSEPOS POP ys =
0 ss = 
{ ys < ss += } [ 329 374 418 464 ] FOREACH
[
;"Start" 
{31 SELECT}

;"Play"
 { myturn GLOBAL btt GLOBAL lastroll GLOBAL
 { co GLOBAL crv GLOBAL mysc GLOBAL ut GLOBAL ckbxs GLOBAL
    dd GLOBAL yhtz GLOBAL
  { crv mysc += 
    0 btt =
    { { "@491,91 )POP !UPPER TABLE BONUS! CONGRATULATIONS!!" ROOMMSG
        50 mysc +=
      } ut 80 < crv ut + 80 >= AND IF
      crv ut += 
    } co 19 < IF
    "I have a score of " mysc ITOA & SAY
    { 1 co SETSPOTSTATE } co 28 < IF
    { 1 co SETSPOTSTATE dd "6" SUBSTR 2 * 1 - yhtz =
    } co 28 == yhtz NOT AND IF
    12 cs = 0 ckbxs = 1 vl =
    { cs ++ cs GETSPOTSTATE ckd = { 1 ckd = } cs co == IF
      { vl ckbxs += } ckd IF 2 vl *=
    } { cs 27 < } WHILE
   0 myturn =
   { ";3" SAY } 
   { ; { 50 mysc += } ut 80 > IF
      ";4" WHOME ITOA & "-" & mysc ITOA & SAY
    { DUP GLOBAL 0 SWAP =
    } [ rollt crv mysc ut yhtz ckbxs myturn co btt ] FOREACH
   } ckbxs 32767 < yhtz NOT OR IFELSE
 } co IF
 }
 { ";1" SAY "yahtroll" SOUND } myturn IFELSE
}

;"Roll" 
 { ref GLOBAL ad GLOBAL rollt GLOBAL crv GLOBAL myturn GLOBAL al25 GLOBAL
{ "" ad = al25 EXEC }
{ { { ME GETSPOTSTATE 1 + ME SETSPOTSTATE
     6 rollt = 0 crv =
     al26 GLOBAL al26 EXEC
    }ME GETSPOTSTATE 4 < IF
  } myturn IF
} ref ad ".." GREPSTR AND IFELSE
}

;"Instructions"
 {
"Instructions are in your log" STATUSMSG
{ LOGMSG } [
"" "***YAHTZEE6 RULES***" ""
"Six dice, four rolls!"
"Upper Table, Triples, Quads, Short & Full Straights, & Chance ALL qualify the same as regular Yahtzee"
"Yahtzee is now 6 of a kind"
"Pents is five of a kind"
"Six Straight is 1, 2, 3, 4, 5, and 6, in any order"
"Full House is 2 of a kind and 4 of a kind"
"Half House is 3 of a kind and 3 of a kind"
"Upper Table Bonus is fifty points when you score eighty in the upper table"
"Check the board for other score changes!"
"" "***General Play***" ""
"To start a Yahtzee6 game, one person clicks on the Start button and becomes the referee." 
"Everyone who wants to play, including the referee, clicks on the Play button to join the game."
"When everyone has joined, the referee clicks the Roll button to start play."
"Anyone can join at any time by clicking the Play button."
"Anyone who wants to quit can click the Quit button to do so."
"Anyone who leaves the room automatically quits!"
"If the referee leaves the room, the game is over!"
"Click on the Start button to reset the game if that happens."
"When play starts, the person whose turn it is clicks Roll button to roll for the first time and get their dice."
"You lock and unlock the dice by clicking on them, locked dice are marked."
"Click on the score sheet in the blank spot you want to score in, or click the Roll button up to three times more."
"When you click on the score sheet, it tells you what you'll score with that option. If you like it, click the Play button to score that 
and finish your turn."
"Clicking on the Upper Table Bonus button tells you how many points you need to get that bonus"
"Scoring YAHTZEES, you score your first Yahtzee the same way you score other scores, by clicking on Yahtzee and then the 
Play button. Score Yahtzee bonuses automatically by first clicking on Yahtzee when you roll one."
"When someone fills out their score card, they automatically give their final score."
"Stick around after you're through as the referee remembers the highest score, and will announce it when everyone finishes!"
"Players can click Play to rejoin an ongoing game after they finish. In that case the game continues until everyone either quits or 
finishes their game."
"" "***Referee Commands" ""
"\x22Player List\x22 produces a list in your log of all current players and numbers - THIS CHANGES EACH TURN"
"\x22Player Drop x\x22 removes player number x from play and goes to the next one if needed"
"NOTE: it is highly recommended that the referee have the new palace client!"
] FOREACH
}

;"Quit" 
 { ref GLOBAL ";6" SAY 
{ { DUP GLOBAL 0 SWAP =
  } [ rollt crv mysc ut yhtz ckbxs myturn co btt lastroll] FOREACH
}
{";5" WHOME PRIVATEMSG } ref IFELSE
}

] ss GET EXEC
}
		ENDSCRIPT
		ENDSPOT
	ENDROOM